package sensors.realSensors;

import bluetoothCommunication.Communicator;
import maze.Coordinate;
import robots.OwnGhost;
import robots.RealGhost;
import sensors.Pilot;
import simulation.Simulator;


public class RealPilot extends Pilot {
	private Communicator comm;
	public RealPilot(RealGhost ghost, Simulator sim) {
		super(ghost, sim);
		this.comm=ghost.getCommunicator();
	}

	@Override
	public void simulateTravel(int distance) {
		
		super.simulateTravel(distance);


	}

	@Override
	public void simulateRotation(int angle) {
		super.simulateRotation(angle);

	}
	public boolean realTravel(int distance){
		comm.travel(distance);
//		if(comm.isPressed()){
//			comm.travel(-10);
//			comm.isPressed(); // om de touchsensor eventueel te resetten
//			Coordinate currentCoordinate = ghost.getMaze().getCoordinateOfLocation(ghost.getLocation());
//			ghost.getMaze().write(currentCoordinate.x,currentCoordinate.y,ghost.generateDirection(ghost.getRotation()) , (char)1, true);
//			return false; // gebotst dus positie mag niet geupdate worden
//		}
		return true;
	}
	public void realRotation(int angle){
		comm.rotateRobot(angle);

	}

	@Override
	public void setSpeed(int speed) {
		super.speed=speed;
		comm.setSpeed(speed);
	}

	@Override
	public int travelWithUltrasonicInterrupt(int distance, int margin) {
		return comm.travelInterrupt(distance, margin);
	}

}
